<template>
  <div>
    <el-dialog
      title="新增菜单"
      :visible.sync="addsDiavisible"
      width="30%"
      :before-close="cancel"
      @opened="beforeopen"
    >
      <el-form :model="seForm" label-width="140px">
        <el-form-item label="级别选择">
          <el-radio v-model="seForm.select" label="1">同级</el-radio>
          <el-radio v-model="seForm.select" label="2" v-if="ifThree==false">下级</el-radio>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="addSubmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      addsDiavisible: false,
      ifThree: false,
      seForm: {
        select: "1",
      },
    };
  },
  created() {},
  methods: {
    //关闭
    cancel() {
      this.addsDiavisible = false;
    },
    //弹窗渲染之前
    beforeopen() {},
    //提交
    addSubmit() {
      this.$emit("transData", this.seForm.select);
      this.cancel();
    },
    //供父组件调用函数
    openDialog(scope) {
      if(scope.level=="3"){
        this.ifThree =true
      }
      this.addsDiavisible = true;
    },
  },
};
</script>